package com.hqyj.springBoot.modules.common.dao;

import com.hqyj.springBoot.modules.common.entity.ExceptionLog;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface ExceptionLogDao {

    @Insert("insert into common_exception_log (ip, path, class_name, method_name, " +
            "exception_type, exception_message, create_date) " +
            "values (#{ip}, #{path}, #{className}, #{methodName}, " +
            "#{exceptionType}, #{exceptionMessage}, #{createDate})")
    @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
    void insertExceptionLogDao(ExceptionLog exceptionLog);

    @Select("select * from common_exception_log where path = #{path} and exception_type = #{exceptionType}")
    List<ExceptionLog> getExceptionLogsBy(@Param("path") String path,@Param("exceptionType") String exceptionType);
}
